Hệ thống xếp lịch học tín chỉ cho sinh viên CNTT trên PHP & MySQL
111.110 lượt xem;
- personal_details_view.php
- project /
1 <?php
2 // This script and data application were generated by AppGini 5.72
3 // Download AppGini for free from https://bigprof.com/appgini/download/
4
5 $currDir=dirname(__FILE__);
6 include("$currDir/defaultLang.php");
7 include("$currDir/language.php");
8 include("$currDir/lib.php");
9 @include("$currDir/hooks/personal_details.php");
10 include("$currDir/personal_details_dml.php");
11
12 // mm: can the current member access this page?
13 $perm=getTablePermissions('personal_details');
14 if(!$perm[0]){
15 echo error_message($Translation['tableAccessDenied'], false);
16 echo '<script>setTimeout("window.location=\'index.php?signOut=1\'", 2000);</script>';
17 exit;
18 }
19
20 $x = new DataList;
21 $x->TableName = "personal_details";
22
23 // Fields that can be displayed in the table view
24 $x->QueryFieldsTV = array(
25 "`personal_details`.`id`" => "id",
26 "`personal_details`.`full_name`" => "full_name",
27 "IF( CHAR_LENGTH(`schools1`.`name`), CONCAT_WS('', `schools1`.`name`), '') /* School */" => "school",
28 "IF( CHAR_LENGTH(`departments1`.`name`), CONCAT_WS('', `departments1`.`name`), '') /* Department */" => "department",
29 "`personal_details`.`year_of_study`" => "year_of_study"
30 );
31 // mapping incoming sort by requests to actual query fields
32 $x->SortFields = array(
33 1 => '`personal_details`.`id`',
34 2 => 2,
35 3 => '`schools1`.`name`',
36 4 => '`departments1`.`name`',
37 5 => 5
38 );
39
40 // Fields that can be displayed in the csv file
41 $x->QueryFieldsCSV = array(
42 "`personal_details`.`id`" => "id",
43 "`personal_details`.`full_name`" => "full_name",
44 "IF( CHAR_LENGTH(`schools1`.`name`), CONCAT_WS('', `schools1`.`name`), '') /* School */" => "school",
45 "IF( CHAR_LENGTH(`departments1`.`name`), CONCAT_WS('', `departments1`.`name`), '') /* Department */" => "department",
46 "`personal_details`.`year_of_study`" => "year_of_study"
47 );
48 // Fields that can be filtered
49 $x->QueryFieldsFilters = array(
50 "`personal_details`.`id`" => "ID",
51 "`personal_details`.`full_name`" => "Full name",
52 "IF( CHAR_LENGTH(`schools1`.`name`), CONCAT_WS('', `schools1`.`name`), '') /* School */" => "School",
53 "IF( CHAR_LENGTH(`departments1`.`name`), CONCAT_WS('', `departments1`.`name`), '') /* Department */" => "Department",
54 "`personal_details`.`year_of_study`" => "Year of study"
55 );
56
57 // Fields that can be quick searched
58 $x->QueryFieldsQS = array(
59 "`personal_details`.`id`" => "id",
60 "`personal_details`.`full_name`" => "full_name",
61 "IF( CHAR_LENGTH(`schools1`.`name`), CONCAT_WS('', `schools1`.`name`), '') /* School */" => "school",
62 "IF( CHAR_LENGTH(`departments1`.`name`), CONCAT_WS('', `departments1`.`name`), '') /* Department */" => "department",
63 "`personal_details`.`year_of_study`" => "year_of_study"
64 );
65
66 // Lookup fields that can be used as filterers
67 $x->filterers = array( 'school' => 'School', 'department' => 'Department');
68
69 $x->QueryFrom = "`personal_details` LEFT JOIN `schools` as schools1 ON `schools1`.`id`=`personal_details`.`school` LEFT JOIN `departments` as departments1 ON `departments1`.`id`=`personal_details`.`department` ";
70 $x->QueryWhere = '';
71 $x->QueryOrder = '';
72
73 $x->AllowSelection = 1;
74 $x->HideTableView = ($perm[2]==0 ? 1 : 0);
75 $x->AllowDelete = $perm[4];
76 $x->AllowMassDelete = false;
77 $x->AllowInsert = $perm[1];
78 $x->AllowUpdate = $perm[3];
79 $x->SeparateDV = 1;
80 $x->AllowDeleteOfParents = 0;
81 $x->AllowFilters = 1;
82 $x->AllowSavingFilters = 0;
83 $x->AllowSorting = 1;
84 $x->AllowNavigation = 1;
85 $x->AllowPrinting = 1;
86 $x->AllowCSV = 1;
87 $x->RecordsPerPage = 10;
88 $x->QuickSearch = 1;
89 $x->QuickSearchText = $Translation["quick search"];
90 $x->ScriptFileName = "personal_details_view.php";
91 $x->RedirectAfterInsert = "personal_details_view.php?SelectedID=#ID#";
92 $x->TableTitle = "Personal details";
93 $x->TableIcon = "resources/table_icons/administrator.png";
94 $x->PrimaryKey = "`personal_details`.`id`";
95
96 $x->ColWidth = array( 150, 150, 150, 150);
97 $x->ColCaption = array("Full name", "School", "Department", "Year of study");
98 $x->ColFieldName = array('full_name', 'school', 'department', 'year_of_study');
99 $x->ColNumber = array(2, 3, 4, 5);
100
101 // template paths below are based on the app main directory
102 $x->Template = 'templates/personal_details_templateTV.html';
103 $x->SelectedTemplate = 'templates/personal_details_templateTVS.html';
104 $x->TemplateDV = 'templates/personal_details_templateDV.html';
105 $x->TemplateDVP = 'templates/personal_details_templateDVP.html';
106
107 $x->ShowTableHeader = 1;
108 $x->TVClasses = "";
109 $x->DVClasses = "";
110 $x->HighlightColor = '#FFF0C2';
111
112 // mm: build the query based on current member's permissions
113 $DisplayRecords = $_REQUEST['DisplayRecords'];
114 if(!in_array($DisplayRecords, array('user', 'group'))){ $DisplayRecords = 'all'; }
115 if($perm[2]==1 || ($perm[2]>1 && $DisplayRecords=='user' && !$_REQUEST['NoFilter_x'])){ // view owner only
116 $x->QueryFrom.=', membership_userrecords';
117 $x->QueryWhere="where `personal_details`.`id`=membership_userrecords.pkValue and membership_userrecords.tableName='personal_details' and lcase(membership_userrecords.memberID)='".getLoggedMemberID()."'";
118 }elseif($perm[2]==2 || ($perm[2]>2 && $DisplayRecords=='group' && !$_REQUEST['NoFilter_x'])){ // view group only
119 $x->QueryFrom.=', membership_userrecords';
120 $x->QueryWhere="where `personal_details`.`id`=membership_userrecords.pkValue and membership_userrecords.tableName='personal_details' and membership_userrecords.groupID='".getLoggedGroupID()."'";
121 }elseif($perm[2]==3){ // view all
122 // no further action
123 }elseif($perm[2]==0){ // view none
124 $x->QueryFields = array("Not enough permissions" => "NEP");
125 $x->QueryFrom = '`personal_details`';
126 $x->QueryWhere = '';
127 $x->DefaultSortField = '';
128 }
129 // hook: personal_details_init
130 $render=TRUE;
131 if(function_exists('personal_details_init')){
132 $args=array();
133 $render=personal_details_init($x, getMemberInfo(), $args);
134 }
135
136 if($render) $x->Render();
137
138 // hook: personal_details_header
139 $headerCode='';
140 if(function_exists('personal_details_header')){
141 $args=array();
142 $headerCode=personal_details_header($x->ContentType, getMemberInfo(), $args);
143 }
144 if(!$headerCode){
145 include_once("$currDir/header.php");
146 }else{
147 ob_start(); include_once("$currDir/header.php"); $dHeader=ob_get_contents(); ob_end_clean();
148 echo str_replace('<%%HEADER%%>', $dHeader, $headerCode);
149 }
150
151 echo $x->HTML;
152 // hook: personal_details_footer
153 $footerCode='';
154 if(function_exists('personal_details_footer')){
155 $args=array();
156 $footerCode=personal_details_footer($x->ContentType, getMemberInfo(), $args);
157 }
158 if(!$footerCode){
159 include_once("$currDir/footer.php");
160 }else{
161 ob_start(); include_once("$currDir/footer.php"); $dFooter=ob_get_contents(); ob_end_clean();
162 echo str_replace('<%%FOOTER%%>', $dFooter, $footerCode);
163 }
164 ?>
2 // This script and data application were generated by AppGini 5.72
3 // Download AppGini for free from https://bigprof.com/appgini/download/
4
5 $currDir=dirname(__FILE__);
6 include("$currDir/defaultLang.php");
7 include("$currDir/language.php");
8 include("$currDir/lib.php");
9 @include("$currDir/hooks/personal_details.php");
10 include("$currDir/personal_details_dml.php");
11
12 // mm: can the current member access this page?
13 $perm=getTablePermissions('personal_details');
14 if(!$perm[0]){
15 echo error_message($Translation['tableAccessDenied'], false);
16 echo '<script>setTimeout("window.location=\'index.php?signOut=1\'", 2000);</script>';
17 exit;
18 }
19
20 $x = new DataList;
21 $x->TableName = "personal_details";
22
23 // Fields that can be displayed in the table view
24 $x->QueryFieldsTV = array(
25 "`personal_details`.`id`" => "id",
26 "`personal_details`.`full_name`" => "full_name",
27 "IF( CHAR_LENGTH(`schools1`.`name`), CONCAT_WS('', `schools1`.`name`), '') /* School */" => "school",
28 "IF( CHAR_LENGTH(`departments1`.`name`), CONCAT_WS('', `departments1`.`name`), '') /* Department */" => "department",
29 "`personal_details`.`year_of_study`" => "year_of_study"
30 );
31 // mapping incoming sort by requests to actual query fields
32 $x->SortFields = array(
33 1 => '`personal_details`.`id`',
34 2 => 2,
35 3 => '`schools1`.`name`',
36 4 => '`departments1`.`name`',
37 5 => 5
38 );
39
40 // Fields that can be displayed in the csv file
41 $x->QueryFieldsCSV = array(
42 "`personal_details`.`id`" => "id",
43 "`personal_details`.`full_name`" => "full_name",
44 "IF( CHAR_LENGTH(`schools1`.`name`), CONCAT_WS('', `schools1`.`name`), '') /* School */" => "school",
45 "IF( CHAR_LENGTH(`departments1`.`name`), CONCAT_WS('', `departments1`.`name`), '') /* Department */" => "department",
46 "`personal_details`.`year_of_study`" => "year_of_study"
47 );
48 // Fields that can be filtered
49 $x->QueryFieldsFilters = array(
50 "`personal_details`.`id`" => "ID",
51 "`personal_details`.`full_name`" => "Full name",
52 "IF( CHAR_LENGTH(`schools1`.`name`), CONCAT_WS('', `schools1`.`name`), '') /* School */" => "School",
53 "IF( CHAR_LENGTH(`departments1`.`name`), CONCAT_WS('', `departments1`.`name`), '') /* Department */" => "Department",
54 "`personal_details`.`year_of_study`" => "Year of study"
55 );
56
57 // Fields that can be quick searched
58 $x->QueryFieldsQS = array(
59 "`personal_details`.`id`" => "id",
60 "`personal_details`.`full_name`" => "full_name",
61 "IF( CHAR_LENGTH(`schools1`.`name`), CONCAT_WS('', `schools1`.`name`), '') /* School */" => "school",
62 "IF( CHAR_LENGTH(`departments1`.`name`), CONCAT_WS('', `departments1`.`name`), '') /* Department */" => "department",
63 "`personal_details`.`year_of_study`" => "year_of_study"
64 );
65
66 // Lookup fields that can be used as filterers
67 $x->filterers = array( 'school' => 'School', 'department' => 'Department');
68
69 $x->QueryFrom = "`personal_details` LEFT JOIN `schools` as schools1 ON `schools1`.`id`=`personal_details`.`school` LEFT JOIN `departments` as departments1 ON `departments1`.`id`=`personal_details`.`department` ";
70 $x->QueryWhere = '';
71 $x->QueryOrder = '';
72
73 $x->AllowSelection = 1;
74 $x->HideTableView = ($perm[2]==0 ? 1 : 0);
75 $x->AllowDelete = $perm[4];
76 $x->AllowMassDelete = false;
77 $x->AllowInsert = $perm[1];
78 $x->AllowUpdate = $perm[3];
79 $x->SeparateDV = 1;
80 $x->AllowDeleteOfParents = 0;
81 $x->AllowFilters = 1;
82 $x->AllowSavingFilters = 0;
83 $x->AllowSorting = 1;
84 $x->AllowNavigation = 1;
85 $x->AllowPrinting = 1;
86 $x->AllowCSV = 1;
87 $x->RecordsPerPage = 10;
88 $x->QuickSearch = 1;
89 $x->QuickSearchText = $Translation["quick search"];
90 $x->ScriptFileName = "personal_details_view.php";
91 $x->RedirectAfterInsert = "personal_details_view.php?SelectedID=#ID#";
92 $x->TableTitle = "Personal details";
93 $x->TableIcon = "resources/table_icons/administrator.png";
94 $x->PrimaryKey = "`personal_details`.`id`";
95
96 $x->ColWidth = array( 150, 150, 150, 150);
97 $x->ColCaption = array("Full name", "School", "Department", "Year of study");
98 $x->ColFieldName = array('full_name', 'school', 'department', 'year_of_study');
99 $x->ColNumber = array(2, 3, 4, 5);
100
101 // template paths below are based on the app main directory
102 $x->Template = 'templates/personal_details_templateTV.html';
103 $x->SelectedTemplate = 'templates/personal_details_templateTVS.html';
104 $x->TemplateDV = 'templates/personal_details_templateDV.html';
105 $x->TemplateDVP = 'templates/personal_details_templateDVP.html';
106
107 $x->ShowTableHeader = 1;
108 $x->TVClasses = "";
109 $x->DVClasses = "";
110 $x->HighlightColor = '#FFF0C2';
111
112 // mm: build the query based on current member's permissions
113 $DisplayRecords = $_REQUEST['DisplayRecords'];
114 if(!in_array($DisplayRecords, array('user', 'group'))){ $DisplayRecords = 'all'; }
115 if($perm[2]==1 || ($perm[2]>1 && $DisplayRecords=='user' && !$_REQUEST['NoFilter_x'])){ // view owner only
116 $x->QueryFrom.=', membership_userrecords';
117 $x->QueryWhere="where `personal_details`.`id`=membership_userrecords.pkValue and membership_userrecords.tableName='personal_details' and lcase(membership_userrecords.memberID)='".getLoggedMemberID()."'";
118 }elseif($perm[2]==2 || ($perm[2]>2 && $DisplayRecords=='group' && !$_REQUEST['NoFilter_x'])){ // view group only
119 $x->QueryFrom.=', membership_userrecords';
120 $x->QueryWhere="where `personal_details`.`id`=membership_userrecords.pkValue and membership_userrecords.tableName='personal_details' and membership_userrecords.groupID='".getLoggedGroupID()."'";
121 }elseif($perm[2]==3){ // view all
122 // no further action
123 }elseif($perm[2]==0){ // view none
124 $x->QueryFields = array("Not enough permissions" => "NEP");
125 $x->QueryFrom = '`personal_details`';
126 $x->QueryWhere = '';
127 $x->DefaultSortField = '';
128 }
129 // hook: personal_details_init
130 $render=TRUE;
131 if(function_exists('personal_details_init')){
132 $args=array();
133 $render=personal_details_init($x, getMemberInfo(), $args);
134 }
135
136 if($render) $x->Render();
137
138 // hook: personal_details_header
139 $headerCode='';
140 if(function_exists('personal_details_header')){
141 $args=array();
142 $headerCode=personal_details_header($x->ContentType, getMemberInfo(), $args);
143 }
144 if(!$headerCode){
145 include_once("$currDir/header.php");
146 }else{
147 ob_start(); include_once("$currDir/header.php"); $dHeader=ob_get_contents(); ob_end_clean();
148 echo str_replace('<%%HEADER%%>', $dHeader, $headerCode);
149 }
150
151 echo $x->HTML;
152 // hook: personal_details_footer
153 $footerCode='';
154 if(function_exists('personal_details_footer')){
155 $args=array();
156 $footerCode=personal_details_footer($x->ContentType, getMemberInfo(), $args);
157 }
158 if(!$footerCode){
159 include_once("$currDir/footer.php");
160 }else{
161 ob_start(); include_once("$currDir/footer.php"); $dFooter=ob_get_contents(); ob_end_clean();
162 echo str_replace('<%%FOOTER%%>', $dFooter, $footerCode);
163 }
164 ?>